#include "photon.hpp"

unsigned short Photon::order = 1;

Photon::Photon(const Color& _color,const Vector& _position,const Vector& _direction) : color(_color) , position(_position), direction(_direction)
{ }

Photon::~Photon(void) { }

void Photon::set_color(const Color& _color) { color = _color; }

void Photon::set_position(const Vector& _position) { position = _position; }

void Photon::set_direction(const Vector& _direction) { direction = _direction; }

void Photon::set_order(unsigned short _order) { order = _order; }

void Photon::next_order(void) { 
	if(order == 3) order = 1;
	else order++;
}

Color Photon::get_color(void) const { return color; }

Vector Photon::get_position(void) const { return position; }

Vector Photon::get_direction(void) const { return direction; }

unsigned short Photon::get_order(void) { return order; }

bool compare (Photon* first, Photon* second)
{
	switch(Photon::get_order()) {
		case 1: {
			if(first->get_position().x <= second->get_position().x) return true;
			break;
		}
		case 2: {
			if(first->get_position().y <= second->get_position().y) return true;
			break;
		}
		case 3: {
			if(first->get_position().z <= second->get_position().z) return true;
			break;
		}
	}
	return false;
}
